$(document).ajaxError(function(event, xhr, options, exc){
    if(xhr.status == 401){
        // 使用正确的路径
        location.href = "/blog_login.html";
    }
});

$(document).ajaxSend(function (e, xhr, opt) {
    var user_token = localStorage.getItem("user_token");
    xhr.setRequestHeader("user_token", user_token);
});

function getUserInfo(userUrl){
                $.ajax({
                type:"get",
                url:userUrl,
                success:function(result){
                    if(result.code==200 && result.data!=null){
                        $(".left .card h3").text(result.data.userName);
                        $(".left .card a").attr("href",result.data.githubUrl);
                         } 
                    }
                });
        }

function logout() {
 //删除Cookie, 设置Cookie为空即可 
 localStorage.removeItem("loginUserId")
 localStorage.removeItem("user_token");
 location.href = "/blog_login.html";
}

